<template>
  <div class="user-banner-preview">
    <el-image v-if="config.data && config.data[0] && config.data[0].image" :src="config.data[0].image" fit="cover"
      class="banner-image">
      <div slot="error" class="image-slot"><i class="el-icon-picture-outline"></i></div>
    </el-image>
    <div v-else class="empty-placeholder">广告位</div>
  </div>
</template>

<script>
  export default {
    name: "UserBannerPreview",
    props: ['config']
  }
</script>

<style scoped>
  .user-banner-preview {
    margin: 15px;
    border-radius: 8px;
    overflow: hidden;
    height: 100px;
  }

  .banner-image {
    width: 100%;
    height: 100%;
    display: block;
  }

  .empty-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #e9e9e9;
    color: #999;
  }
</style>
